package main

import (
	"lister/config"
	"lister/core"
	"os"
	"os/signal"
	l "util/log"
)

func main() {

	c := config.CreateConfig()
	if !c.Load() {
		l.LogError("load config failed")
		return
	}

	ch := make(chan bool)

	ls := core.GetLister()
	go ls.Start(c, ch)

	s := make(chan os.Signal, 1)
	signal.Notify(s, os.Interrupt)
	go func() {
		select {
		case <-s:
			core.ServiceQuit()
			l.TraceInfo("lister", "stop service")
		}
	}()

	<-ch

}
